package com.taocyb.constant;

/**
 * 是/否 状态通用枚举  
 */
public enum YesOrNoStatus {
	YES(1, "是"),
	NO(0, "否");
	
	public final int key;
	public final String value;
	
	private YesOrNoStatus(int key, String value){
		this.key = key;
		this.value = value;
	}
	
	/**
	 * 根据key返回枚举对象
	 */
	public static YesOrNoStatus getEnum(int key){
		YesOrNoStatus[] objects = YesOrNoStatus.values();
		for(YesOrNoStatus obj : objects){
			if(obj.key == key){
				return obj;
			}
		}
		
		return null;
	}

	public int getKey() {
		return key;
	}

	public String getValue() {
		return value;
	}
}
